﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EasyPayDemo.WeiPay
{
    public class ExcuteQrGetUserId : IFunction
    {
        public override void Execute()
        {
            M_QrGetUserId request = new M_QrGetUserId();

            request.orgId = WeiPayConfig.orgId;
            request.orgMercode = WeiPayConfig.orgMercode;
            request.orgTermno = WeiPayConfig.orgTermno;
            request.signType = WeiPayConfig.SIGN_TYPE_RSA256;

            request.orgTrace = WeiPayUtils.GetOrgTrace(WeiPayConfig.orgId);

            M_QrGetUserId.Data dataBean = new M_QrGetUserId.Data();
            dataBean.qrUserAuthCode = "6226176223328162414";
            dataBean.qrAppUpIdentifier = "";

            request.data = dataBean;

            var chkStr = WeiPayUtils.GetSignData<M_QrGetUserId.Data>(dataBean);
            string sign = EncryptionUtil.RSASignJavaBouncyCastle(chkStr.ToString(), WeiPayConfig.PrivateKey, "SHA256withRSA");
            request.sign = sign;

            var result = HttpPost<M_QrGetUserId>(WeiPayConfig.ApiUrlGetUserId, request);
        }
    }
}
